import java.util.HashMap;
import java.util.Map;


public class symbolTable {
	static Map<String,String> table = new HashMap<String,String>();
	
	public symbolTable(){
		
	}
	public static void add(String var, String val){
		if(table.containsKey(var)){
			System.out.println("Error: duplicate id: " + var );
			System.exit(1);
		}
		table.put(var, val);
	}
	public static boolean is_in_table(String var){
		return table.containsKey(var);
	}
	public static String get_val(String var){
		String val = table.get(var);
		table.put(var, val);
		return val;
		
	}
	public static boolean is_initialized(String var){
		String val = table.get(var);
		table.put(var, val);
		boolean t = (val != null);
		return t;
		
	}
	public static void print(){
		Map<String,String> table2 = new HashMap<String,String>(table);
		System.out.println(table2.toString());
	}
	
}
